﻿using Core;
using Core.Domain.Customers;
using System;
using System.Collections.Generic;

namespace Services.Customers
{
    /// <summary>
    /// 用户服务接口
    /// </summary>
    public partial interface ICustomerService
    {
        #region Customers
        /// <summary>
        /// 获取用户
        /// </summary>
        /// <returns></returns>
        IPagedList<Customer> GetAllCustomers(
            int[] customerRoleIds = null, string email = null, string username = null,
            string Name = null,
            string phone = null,
            int pageIndex = 0, int pageSize = 2147483647); //Int32.MaxValue

        /// <summary>
        /// 在线用户
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        IPagedList<Customer> GetCustomers(int pageIndex, int pageSize);

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="customer"></param>
        void DeleteCustomer(Customer customer);

        /// <summary>
        /// 根据主键获取用户
        /// </summary>
        /// <param name="customerId"></param>
        /// <returns></returns>
        Customer GetCustomerById(int customerId);

        /// <summary>
        /// 根据主键集合获取用户
        /// </summary>
        /// <param name="customerIds"></param>
        /// <returns></returns>
        IList<Customer> GetCustomersByIds(int[] customerIds);

        /// <summary>
        /// 根据Guid获取用户
        /// </summary>
        /// <param name="customerGuid"></param>
        /// <returns></returns>
        Customer GetCustomerByGuid(Guid customerGuid);

        /// <summary>
        /// 根据Email获取用户
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        Customer GetCustomerByEmail(string email);

        /// <summary>
        /// 根据手机号获取用户
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        Customer GetCustomerByPhone(string phone);

        /// <summary>
        /// 根据用户名获取用户
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        Customer GetCustomerByUsername(string username);

        /// <summary>
        /// 根据类型获取用户
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        Customer GetCustomer(string Name, RegisterMethod method);
        
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="customer"></param>
        void InsertCustomer(Customer customer);

        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="customer"></param>
        void UpdateCustomer(Customer customer);

        /// <summary>
        /// 增加匿名访客
        /// </summary>
        /// <returns></returns>
        Customer InsertGuestCustomer();

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="createdFromUtc"></param>
        /// <param name="createdToUtc"></param>
        /// <param name="onlyWithoutShoppingCart"></param>
        /// <param name="maxNumberOfRecordsToDelete"></param>
        /// <returns></returns>
        int DeleteGuestCustomers(DateTime? createdFromUtc,
            DateTime? createdToUtc, bool onlyWithoutShoppingCart,
            int maxNumberOfRecordsToDelete);

        #endregion

        #region Role
        /// <summary>
        /// 获取用户权限
        /// </summary>
        /// <param name="roleName"></param>
        /// <returns></returns>
        CustomerRole GetCustomerRoleBySystemRole(string roleName);

        /// <summary>
        /// 删除系统权限
        /// </summary>
        /// <param name="customerRole"></param>
        void DeleteCustomerRole(CustomerRole customerRole);

        /// <summary>
        /// 根据Id获取权限
        /// </summary>
        /// <param name="customerRoleId"></param>
        /// <returns></returns>
        CustomerRole GetCustomerRoleById(int customerRoleId);

        /// <summary>
        /// 获取所有权限
        /// </summary>
        /// <returns></returns>
        IList<CustomerRole> GetAllCustomerRoles();

        /// <summary>
        /// 新增权限
        /// </summary>
        /// <param name="customerRole"></param>
        void InsertCustomerRole(CustomerRole customerRole);

        /// <summary>
        /// 更新权限
        /// </summary>
        /// <param name="customerRole"></param>
        void UpdateCustomerRole(CustomerRole customerRole);

        #endregion

    }
}
